{include file="header.html"}    
{include file="title.html"}
<div class="category_index clearfix">
<div class="left">
	<ul>
		<!--{foreach from=$gcategorys item=gcategory name=fe_gcate}-->
		<li data-id="{$gcategory.id}"><a id="cate_parent_{$gcategory.id}" {if $gcategory.no_children}href="index.php?app=search&cate_id={$gcategory.id}"{else}href="javascript:void(0)" {if $smarty.foreach.fe_gcate.first}class="cur"{/if} onclick="show_child({$gcategory.id})"{/if}>{$gcategory.value|escape}</a></li>
		<!--{/foreach}-->
                <div class="li_wrap"></div>
	</ul>
</div>
<div class="right">
<!--{foreach from=$gcategorys item=gcategory name=fe_gcate}-->
<div id="cate_son_{$gcategory.id}" class="cate_son" {if !$smarty.foreach.fe_gcate.first}style="display:none"{/if}>
	<!--{foreach from=$gcategory.children item=child1}-->
        <div class="cate_son_wrap">
	<a href="index.php?app=search&cate_id={$child1.id}"><h4>{$child1.value|escape}</h4></a>
	<ul>
		<!--{foreach from=$child1.children item=child2}-->
                <li>
		<a href="index.php?app=search&cate_id={$child2.id}">
		<div class="img_wrap"><p class="img"><img src="{$site_url}/{$child2.cate_logo|escape}"></p></div>
		<p class="title">{$child2.value|escape}</p>
		</a>
                    </li>
		<!--{/foreach}-->
	</ul>
        </div>
	<!--{/foreach}-->
</div>
<!--{/foreach}-->
</div>
</div>
<script>
    var cate_top=new Array();
    $(function(){
        $(".category_index .left ul li").each(function(){
            var id=$(this).attr('data-id');
            cate_top[id]=$(this).offset().top-43;
        });
    })
    function show_child(id){
        //var cate_top = $('#cate_parent_'+id).offset().top-43;
        $(".category_index .left ul").animate({scrollTop: cate_top[id]},300);
        $(".category_index .left ul li a").removeClass('cur');
        $('#cate_parent_'+id).addClass('cur');
        
        $(".cate_son").hide();
        $("#cate_son_"+id).show();
    }
</script>
{include file="footer.html"}